﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SQLite;
using System.Data;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string name = Convert.ToString(Console.ReadLine());
            SQLiteConnection conn = new SQLiteConnection(@"data source =C:\Users\xiaoming\Desktop\data\" + name + ".db");
            conn.Open();
            SQLiteCommand cmd = conn.CreateCommand();
            cmd.CommandText = @"select * from topics";
            SQLiteDataAdapter da = new SQLiteDataAdapter(cmd);
            DataSet ds = new DataSet();
            da.Fill(ds);
            using (StreamWriter sw = new StreamWriter(@"C:\Users\xiaoming\Desktop\filter" + name + ".txt"))
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    sw.WriteLine(Convert.ToString(ds.Tables[0].Rows[i]["topic"]));
                    //Console.Read();
                }
            }
            //Console.Read();
        }
    }
}